#ifndef _DOWNLOAD_MANAGER_H
#define _DOWNLOAD_MANAGER_H

#include <QNetworkAccessManager>
#include <QString>
#include <QUrl>
#include <QUuid>

struct DownloadRequest
{
	QNetworkReply*  m_networkReply;
	QString			m_filename;
	QUrl			m_url;
	bool			operator==(const DownloadRequest&);
};

class DownloadManager: public QObject
{
		Q_OBJECT
		QNetworkAccessManager		manager;
		QList<DownloadRequest>	currentDownloads;

	public:
		DownloadManager(QObject* parent);
		void						doDownload(DownloadRequest);
		bool						saveToDisk(const QString &filename, QIODevice *data);

	public slots:
		void						downloadFinished(QNetworkReply *reply);
};

#endif
